package wo.department.dto;

import java.util.ArrayList;
import java.util.List;

import wo.common.util.WoUtil;
import wo.common.entity.WoPage;
import wo.department.po.Department;

/**
 * PO实体Department对应的DTO类.
 * @author cailei
 */
public class DepartmentDto extends DepartmentDto_ {

	/**
	 * 无参构造函数
	 */
	public DepartmentDto() {
		super ();
	}

	/**
	 * 构造函数,通过po构造dto
	 */
	public DepartmentDto(Department po) {
		super (po);
	}
	
	/**
	 * 将PO列表数据转化为DTO列表数据
	 * @param pos
	 * @return
	 */
	public static List<DepartmentDto> getDtos (List<Department> pos) {
		List<DepartmentDto> rs = new ArrayList<DepartmentDto>();
		for (Department r : pos) {
			DepartmentDto dto = new DepartmentDto(r);
			rs.add(dto);
		}
		return rs;
	}
	
	/**
	 * 将分页PO数据转化为DTO分页数据
	 * @param pos 当前页的PO数据集合
	 * @param total 数据总行数
	 * @return
	 */
	public static WoPage<DepartmentDto> getPageData(List<Department> pos, Long total) {
		WoPage<DepartmentDto> puDto = new WoPage<DepartmentDto>(getDtos(pos), total);
		return puDto;
	}
	
}
